#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>


int main(int argc, char const *argv[])
{
    pid_t pid = fork();

    if (pid == 0) {
        printf("进入子进程\n");
        char *path = "/bin/ping";
        char *argv[] = {path, "-c","3","www.baidu.com", NULL};
        int result = execve(path, argv, NULL);
        printf("子进程结束\n");
    }else if (pid > 0) {
        printf("进入父进程\n");
    }

    return 0;
}
